﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;

namespace Zen4SyncReport.DAL
{
    /// <summary>
    /// Extends the "activity" entity with convenient properties.
    /// </summary>
    public partial class testSession
    {
        #region - Properties -

        /// <summary>
        /// Gets the number of distinct Test Servers involved in the Test Session.
        /// </summary>
        public int TestServersInvolvedCount
        {
            get { return TestServersInvolved.Count(); }
        }

        /// <summary>
        /// Gets a list of all the distincts Test Servers involved in the Test Sessions.
        /// </summary>
        public List<testServer> TestServersInvolved
        {
            get
            {
                return this.clientSession
                    .Select(c => c.testServer)
                    .Distinct()
                    .ToList();
            }
        }

        /// <summary>
        /// Indicates if the Test Session State is "Completed".
        /// </summary>
        public bool IsCompleted
        {
            get
            {
                return this.testSession_testSessionStateId == GuidReference.TestSessionState_Completed;
            }
        }

        /// <summary>
        /// Gets all the distincts Test Scenarios involved in the Test Session.
        /// </summary>
        public List<testScenario> TestScenariosInvolved
        {
            get
            {
                return this.clientSession
                    .Select(c => c.testScenario)
                    .Distinct()
                    .ToList();
            }
        }

        #endregion - Properties -
    }
}
